Parsing PHP in D.
Published 2006-06-01 08:55:54
I keep meaning to write a full log of the whole mythtv experience, as the number of hardware headaches that that has gone through is enough for at least 4 or 5 posts (including the need to rebuild from scratch this whole server a few weeks ago due to hard disk failures from overheating..). But this week, for what seems like the first time this year, I actually scraped 2 days to work on yet another new pet project. Phpmole's replacement....
Phpmole is my lifeblood for development, when I wrote it, I added all the features that where missing from other editors, and the resulting editor made a huge difference to my productivity.
However Phpmoles code base is now pretty old, and was written before I did much PEAR work (eg. it's messy....). There are alot of design decisions that related to PHPGTK1, and the need at the time to implement file transports (ssh/midgard/file) etc. Which are now redundant as things like sshfs do that much better.
So I've started hacking on leds, the editor I mentioned before when hacking on D. It has the benefit of being relatively small codebase wise, and very easy to understand. Let alone it's fast and runs as a binary, so I can eventually just compile the lib's and distribute them, rather than a huge array of php files.
Anyway, the first stage in the great conquest was to teach leds a little about PHP. So starting with Zend's lexer, I hand crafted a reasonably complete lexer in D, (it ignores variables in quoted strings, and heredocs), but should be enough to grab defined classes/methods/vars etc. and work out where to put the folding...
While at present, it's has a few in-efficiencies, as the design was a little organic. It is however quite an interesting way to build a generic language parser and only took 2 days to write and test.. http://www.akbkhome.com/svn/D_Stuff/leds/PhpParser.d
Phpmole is my lifeblood for development, when I wrote it, I added all the features that where missing from other editors, and the resulting editor made a huge difference to my productivity.
- code folding
Although annoying at times, is a good way to dive into new code. - autocompletion
look up PHP functions / variable names etc. - inline help hints
show the signature of a php method inline. - List of open files on a left bar.
Since I often have 30+ files open, this is very usefull to flip between them. - Standard editor features, like syntax highlighting etc.
However Phpmoles code base is now pretty old, and was written before I did much PEAR work (eg. it's messy....). There are alot of design decisions that related to PHPGTK1, and the need at the time to implement file transports (ssh/midgard/file) etc. Which are now redundant as things like sshfs do that much better.
So I've started hacking on leds, the editor I mentioned before when hacking on D. It has the benefit of being relatively small codebase wise, and very easy to understand. Let alone it's fast and runs as a binary, so I can eventually just compile the lib's and distribute them, rather than a huge array of php files.
Anyway, the first stage in the great conquest was to teach leds a little about PHP. So starting with Zend's lexer, I hand crafted a reasonably complete lexer in D, (it ignores variables in quoted strings, and heredocs), but should be enough to grab defined classes/methods/vars etc. and work out where to put the folding...
While at present, it's has a few in-efficiencies, as the design was a little organic. It is however quite an interesting way to build a generic language parser and only took 2 days to write and test.. http://www.akbkhome.com/svn/D_Stuff/leds/PhpParser.d
Mentioned By:
google.com : php parser (90 referals)
google.com : april (76 referals)
google.com : php parse (73 referals)
google.com : php parsing (69 referals)
google.com : parse php (49 referals)
google.com : december (45 referals)
google.com : parsing php (41 referals)
google.com : php parse text file (39 referals)
planet-php.org : Planet PHP (37 referals)
google.com : php parse text (37 referals)
google.com : php parse time (27 referals)
www.abcphp.com : Alan Knowles' Blog: Parsing PHP in D. - abcphp.com (26 referals)
www.phpdeveloper.org : PHPDeveloper.org: Alan Knowles' Blog: Parsing PHP in D. (25 referals)
google.com : php parsing text (23 referals)
google.com : php parse POST (22 referals)
www.php-mag.net : International PHP Magazine::News::List of The News (19 referals)
swik.net : PHP: Hypertext Preprocessor : Planet PHP : Parsing PHP in D. - SWiK (18 referals)
google.com : php parse variable (17 referals)
google.com : parser php (14 referals)
google.com : parse text php (12 referals)
google.com : php parser (90 referals)
google.com : april (76 referals)
google.com : php parse (73 referals)
google.com : php parsing (69 referals)
google.com : parse php (49 referals)
google.com : december (45 referals)
google.com : parsing php (41 referals)
google.com : php parse text file (39 referals)
planet-php.org : Planet PHP (37 referals)
google.com : php parse text (37 referals)
google.com : php parse time (27 referals)
www.abcphp.com : Alan Knowles' Blog: Parsing PHP in D. - abcphp.com (26 referals)
www.phpdeveloper.org : PHPDeveloper.org: Alan Knowles' Blog: Parsing PHP in D. (25 referals)
google.com : php parsing text (23 referals)
google.com : php parse POST (22 referals)
www.php-mag.net : International PHP Magazine::News::List of The News (19 referals)
swik.net : PHP: Hypertext Preprocessor : Planet PHP : Parsing PHP in D. - SWiK (18 referals)
google.com : php parse variable (17 referals)
google.com : parser php (14 referals)
google.com : parse text php (12 referals)
Follow us
-
- Some thoughts on the language server and its usefulness in the roobuilder
- Roo Builder for Gtk4 moving forward
- Clustered Web Applications - Mysql and File replication
- GitLive - Branching - Merging
- PDO_DataObject Released
- PDO_DataObject is under way
- Mass email Marketing and anti-spam - some of the how-to..
- Hydra - Recruitment done right
Blog Latest
-
Twitter - @Roojs